package com.panasonic.web.controller.exam;


import com.panasonic.web.domain.cms.CmsExamScore;
import com.panasonic.web.service.ICmsExamScoreService;
import com.panasonic.common.annotation.Log;
import com.panasonic.common.core.controller.BaseController;
import com.panasonic.common.core.domain.AjaxResult;
import com.panasonic.common.core.page.TableDataInfo;
import com.panasonic.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 考试分数Controller
 * 
 * @author lwf
 * @date 2021-11-16
 */
@RestController
@RequestMapping("/cms/score")
@Api(value = "CmsExamScore", tags = "考试分数")
public class CmsExamScoreController extends BaseController
{
    @Autowired
    private ICmsExamScoreService cmsExamScoreService;

    /**
     * 查询考试分数列表
     */
    @ApiOperation(value = "查询")
    @GetMapping("/list")
    public TableDataInfo list(CmsExamScore cmsExamScore)
    {
        startPage();
        List<CmsExamScore> list = cmsExamScoreService.selectCmsExamScoreList(cmsExamScore);
        return getDataTable(list);
    }


    /**
     * 获取考试分数详细信息
     */
    @ApiOperation(value = "获取考试分数详细信息")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(cmsExamScoreService.selectCmsExamScoreById(id));
    }

    /**
     * 新增考试分数
     */
    @ApiOperation(value = "新增考试分数")
    @Log(title = "考试分数", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CmsExamScore cmsExamScore)
    {
        return toAjax(cmsExamScoreService.insertCmsExamScore(cmsExamScore));
    }

    /**
     * 修改考试分数
     */
    @ApiOperation(value = "修改考试分数")
    @Log(title = "考试分数", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CmsExamScore cmsExamScore)
    {
        return toAjax(cmsExamScoreService.updateCmsExamScore(cmsExamScore));
    }

    /**
     * 删除考试分数
     */
    @ApiOperation(value = "删除考试分数")
    @Log(title = "考试分数", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cmsExamScoreService.deleteCmsExamScoreByIds(ids));
    }



}
